package com.itheima.server.service;

import com.itheima.api.UserApi;
import com.itheima.domain.User;
import com.itheima.server.interceptor.UserHolder;
import com.itheima.vo.HuanXinUserVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class HuanXinService {

    @DubboReference
    private UserApi userApi;

    /**
     * 获取环信账户信息
     * @return
     */
    public HuanXinUserVo getHxUser() {
        User user = userApi.findByMobile(UserHolder.getMobile());
        if (user == null){
            return null;
        }
        return new HuanXinUserVo(user.getHxUser(),user.getHxPassword());
    }


}
